package com.itguigu.spzx.order.service.impl;


import com.itguigu.spzx.feign.order.UserOpenFeign;
import com.itguigu.spzx.model.entity.Order;
import com.itguigu.spzx.model.entity.User;

import com.itguigu.spzx.order.mapper.OrderMapper;
import com.itguigu.spzx.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderMapper orderMapper ;
    @Autowired
    RestTemplate restTemplate;
    @Autowired
    UserOpenFeign userOpenFeign;

    @Override
    public Order findOrderByOrderId(Long orderId) {
        Order order = orderMapper.findOrderByOrderId(orderId);
        User user = userOpenFeign.findUserByUserId(order.getUserId());
        order.setUser(user);
        return order;
    }

}